/***************************************************************
 * @Copyright(C)    2020-2021, wangchongwei
 * @FileName:       linear_interp.h
 * @Author:         wangchongwei
 * @Version:        0.1.1
 * @LastDate:       2021.8.14
 ************************************************************/
#ifndef _LINEAR_INTERP_H_
#define _LINEAR_INTERP_H_

#include <stdint.h>


#ifdef __cplusplus
extern "C" {
#endif

struct LinearInterp
{
    // 初始化曲线
    void (*Init)(struct LinearInterp *self,
                float *arr_x, float *arr_y,
                uint32_t size);    
    // 调用计算
    float (*Cal)(struct LinearInterp *self, float val);

    float out;

    struct 
    {
        float *arr_x;
        float *arr_y;
        int32_t size;
    }pvt;
};

void LinearInterp_Create(struct LinearInterp *self);


#ifdef __cplusplus
}
#endif

#endif
